
import React, { Component } from 'react';
import {
  Platform,
  StyleSheet,
  Text,
  View,
  Image,
  WebView,
  TouchableOpacity,
} from 'react-native';
export default class ShopDetailView extends Component {
  constructor(props){
    super(props);
    this.state=({
      detailUrl:this.props.url+
      '?uuid=5C7B6342814C7B496D836A69C872202B5DE8DB689A2D777DFC717E10FC0B4271&utm_term=6.6&utm_source=AppStore&utm_content=5C7B6342814C7B496D836A69C872202B5DE8DB689A2D777DFC717E10FC0B4271&version_name=6.6&userid=160495643&utm_medium=iphone&lat=23.134709&utm_campaign=AgroupBgroupD100Ghomepage_shoppingmall_detailH0&token=b81UqRVf6pTL4UPLLBU7onkvyQoAAAAAAQIAACQVmmlv_Qf_xR-hBJVMtIlq7nYgStcvRiK_CHFmZ5Gf70DR47KP2VSP1Fu5Fc1ndA&lng=113.373890&f=iphone&ci=20&msid=0FA91DDF-BF5B-4DA2-B05D-FA2032F30C6C2016-04-04-08-38594'
    })
  }
  render() {
    console.log('this.props.url',this.props.url);
    return (
      <View style={styles.container}>
        {this.renderNavBar()}
        <WebView
          automaticallyAdjustContentInsets={true}
          source={{uri: this.state.detailUrl}}
          javaScriptEnabled={true}
          domStorageEnabled={true}
          decelerationRate="normal"
          startInLoadingState={true}
        />
      </View>
    );
  }
  renderNavBar(){
    return(
      <View style={styles.navOutViewStyle}>
        <TouchableOpacity onPress={()=>{this.props.navigator.pop()}} style={styles.leftViewStyle}>
          <Image source={{uri:'back_n'}} style={styles.nvaImgStyle}/>
        </TouchableOpacity>
        <Text style={{color:'white',fontSize:16,fontWeight:'bold'}}>购物中心详情</Text>
        <TouchableOpacity onPress={()=>{alert('更多')}} style={styles.rightViewStyle}>
          <Image source={{uri:'icon_setting'}} style={styles.nvaImgStyle}/>
        </TouchableOpacity>
      </View>
    );
  }
}

const styles = StyleSheet.create({
  container: {
    flex:1,
    backgroundColor:'white',
  },
  navOutViewStyle:{
    height:Platform.OS === 'ios'?64:44,
    backgroundColor:'rgba(255,96,0,1)',
    flexDirection:'row',
    justifyContent:'center',
    alignItems:'center',
  },
  rightViewStyle:{
    //borderWidth:StyleSheet.hairlineWidth,
    //borderColor:'white',
    position:'absolute',
    right:10,
  },
  leftViewStyle:{
    position:'absolute',
    left:10,
  },
  nvaImgStyle:{
    width:Platform.OS === 'ios'?28:24,
    height:Platform.OS === 'ios'?28:24,
  },
});
